#+TITLE: Why I Changed the Site's Build System - Kevin "The Nuclear" Bloom's Personal Website
#+OPTIONS: toc:nil num:nil tex:t title:nil

* Why I Changed the Site's Build System

#+BEGIN_PREVIEW
I started off this website in [[https://common-lisp.net/][Common Lisp]] then to org-mode and now finally to a
mixture of the two?! Well, okay, not really a mixture - more like a semi-similar
adaptation. Okay, that's not really true either... Lemme just explain it simply:
the new build system using [[https://gnu.org/software/emacs][Emacs]] [[https://orgmode.org][org-mode]], [[https://www.gnu.org/software/make/][make]], and a small [[https://fennel-lang.org][Fennel]] script. Why
is this better than using plain old org? Let me explain...
#+END_PREVIEW


I started off writing the site with [[https://common-lisp.net/][Common Lisp]] because I love Common Lisp! It's
the language that got me into software and one of my favorite languages! After
writing the site and sitting back to look at it, I realized that maybe it was
overkill to use Common Lisp to do this... I mean, the site is 100% static...


So, I looked elsewhere and found out how to use org-mode to make a site. I used
[[https://ogbe.net/][Dennis Ogbe's]] [[https://ogbe.net/blog/blogging_with_org.html][guide]] to do this. Surely /this/ was the answer! - Not so
fast... Very shortly after I finished the site /again/, I sat back and looked at
it and realized that org-mode updated and =:sitemap-function= changed... Dennis
never updated his blog so I was left with a broken build system. I spent a lot
of time trying to get it working and came to the conclusion that this is _waaay_
too complicated just for the ease of org-mode's HTML exporting. I wonder, how
could I get the best of /both/ worlds?


Around this time I was falling in love with [[https://fennel-lang.org][Fennel]] due to me working on [[https://notabug.org/dragora/qire][qire]]. I
had an idea! What if I wrote a little Fennel program that took some HTML for the
header and footer then mashed it together with some body HTML. That's where the
concept of my [[https://notabug.org/nuclearkev/website/src/master/pg.fnl][PG]] (Page Generator) program can from. That was great but I didn't
want to have to write a bunch of HTML when I wanted to upload a new blog - and I
didn't want to have to compile each page one-by-one. That's when I came up with
the idea of using Emacs and make.


Turns out you can write emacs scripts... Who knew?! So I did that and it takes
the org file, dumps it into a temp buffer, then exports it to HTML. Works like a
charm! Then we just put the emacs script and PG into a makefile and we're done!
Just run =make= and it will export the org files to HTML, parse the body, smash
it together, and put it into an output directory. Then you just server it! :)


How is this easier than just using org? Well, it's not necessarily /easier/,
it's /simpler/. What this mean is that you can clearly understand each step in
the process. With almost zero experience with emacs or org. Plus, I know that
it'll always work! Unless emacs no longer allows scripts or org's
=org-export-to-file= function stops working, it'll work. Yes, yes, it's "more
work" to add in a new blog - but c'mon, it's not that bad! Create the org file,
type in it, copy the information to properly link to it in the blog page, and
run =make=. That's not /too/ difficult, is it?
